function [U, S, V] = RandomSVD(A, MaxRank)

nRand = MaxRank + 20;

[nRow, nCol] = size(A);
MatRand = randn(nRand, nRow);
R = MatRand*A;
% [Q, TempS, TempV, flag] = svds(transpose(R), MaxRank);
% flag
[Q, TempS, TempV] = svd(R', 0);
Q = Q(:, 1:MaxRank);
T = A*Q;
[U, S, W] = svd(T, 0);
V = Q*W;
